<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>

<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>


<div class="container">
    <h1 style="float:left;">Administrador de Horarios</h1>

    <div class="clear"></div>
    <br/>
    <form:form action="index" method="post" commandName="canchaHorarioForm" cssClass="form-horizontal">


        <table class="table table-striped">
            <tr>
                <th style="width: 100px;"></th>
                <c:forEach var="dia" items="${dias}">
                    <th>
                        ${dia.descripcionDias}
                    </th>
                </c:forEach>
            </tr>


            <tr> <td style="width: 100px;">${horas[0].descripcionHoras} </td>

                <c:forEach items="${canchaHorarioForm.canchasHorarios}" var="canchaHorario" varStatus="status">
                    <td align="center">



                        <input type="checkbox" name="canchasHorarios[${status.index}].activo" value="${canchaHorario.activo}" <c:if test="${canchaHorario.activo==1}">checked</c:if>  />

                        </td>
                    <c:if test="${status.count % 7==0}">
                    </tr>
                    <tr> <td style="width: 100px;">${horas[status.count/7].descripcionHoras} </td>

                    </c:if>   
                </c:forEach>
            </tr>            
        </table>

        <c:if test="${ empty canchasHorariosBD}">

            <div class="actions" style="margin-left: 160px;">
                <input name="" value="Save" type="submit" class="btn btn-primary">
                <a style="margin-left: 5px;" href="<c:url value='/pages/canchas/index'/>">Cancelar</a>
            </div>
        </c:if>

        <c:if test="${ not empty canchasHorariosBD}">
            <div class="actions" style="margin-left: 160px;">

                <a style="margin-left: 5px;" href="<c:url value='/pages/canchas/index'/>">Regresar</a>
            </div>
        </c:if>

    </form:form>
</div>
